<html>
  <head>
    <meta charset="utf-8">
    <title>test ajax array</title>
  </head>
  <body>

   <button id="btn" >查询</button>
             
  </body>
  <script src="http://cdn.bootcss.com/jquery/2.1.3/jquery.min.js"></script>

  <script>

      $("#btn").click(function() {
      	alert("233");

		sendDate();

});


  function sendDate () {
    "use strict";
  	var array_input=new Array();
  	for(var i=0;i<3;i++){
  		array_input[i]=new Array();
  	}
  	for (var i = array_input.length - 1; i >= 0; i--) {
  		for (var j = array_input.length - 1; j >= 0; j--) {
        var Ram = parseInt(Math.random()*100); 
  			array_input[i][j] = Ram;
  		}  		
  	}
    console.log(array_input);
  	var jsonstr={};
	jsonstr="[";
	for(var i=0;i<array_input.length;i++){
    jsonstr +=  "{";
    for(var j=0;j<array_input.length;j++){ 
      if(j == array_input.length-1){
        jsonstr += "a"+i+j+ ":" + array_input[i][j];
      }else{   
        jsonstr += "a"+i+j+ ":" + array_input[i][j]+",";
      }
    }
    jsonstr +=  "},";
	}
	jsonstr = jsonstr.substring(0,jsonstr.lastIndexOf(','));
	jsonstr += "]";
	console.log(jsonstr);
  var data = eval('(' + jsonstr + ')'); 
	console.log(data);
    $.ajax({
      url:"test_ajax_array.php",
      data:{"items":data},
      type:"POST",
      dataType:"json",
      beforeSend : function(xhr) {  
        //花式转菊花
      },
      success:function(data) {
        console.log(data);
      },
      error:function(error) {
        console.log("error");
      }
    });
  }
  </script>
</html>

